
 
<form class="form-horizontal" method="Post" id="busqueda">
<!--    <input type="hidden" id="txt_menu" name="txt_menu" value="1" >-->
    <legend>Busqueda</legend>
    <table>
        <tr>
            <td>
                <div class="control-group">
                    <label class="control-label" for="inputEmail">DNI</label>
                    <div class="controls">
                        <input class="input-small" type="text" id="txt_dni" name="txt_dni" placeholder="dni">
                    </div>
                </div>
            </td>
            <td>
                <div class="control-group">
                    <label class="control-label" for="inputEmail">Apellido</label>
                    <div class="controls">
                        <input class="input-medium" type="text" id="txt_apellido" name="txt_apellido" placeholder="Apellido">
                    </div>
                </div>
            </td>
            <td>
                <div class="control-group">
                    <label class="control-label">Seleccionar</label>
                    <div class="controls">
                        <select id="estado_ingreso" name="estado_ingreso" class="input-medium">
                            <option value="0">Todas</option>
                            <option value="1">Activos</option>
                            <option value="2">Historicos</option>
                        </select>
                    </div>
                </div>
            </td>
            <!--align="center" style="padding-left: 20px;" -->
            <td>
                
                <div class="control-group">
                    <div class="controls" >
                        <input  style="margin-left: -100px;" class="btn btn-primary " type="submit" name="buscar" value="Buscar "> 
                    </div>
                </div>
                
            </td> 
        </tr>
    </table>
</form>

<?php if ($this->marca):?>
<?php switch ($this->activos) {
     case 0: ?>
        <legend>&nbsp;&nbsp;</legend>
        <div style="margin-bottom: 10px;">
            <span class="label label-inverse" style="font-size: 25px;">Todos:</span>
        </div>
        
<!--        <h3>
           <p style="text-height: max-size;" class="text-info">
               Todos:
           </p> 
        </h3>-->
        
     <?php break;
     
     case 1: ?>
         <legend>&nbsp;&nbsp;</legend>
         <div style="margin-bottom: 10px;">
            <span class="label label-inverse" style="font-size: 25px;">Activos:</span>
         </div>
<!--         <h3>
           <p style="text-height: max-size;" class="text-info">
               Activos:
           </p> 
         </h3>-->
     <?php break;
     
     case 2: ?>
         <legend>&nbsp;&nbsp;</legend>
         <div style="margin-bottom: 10px;">
            <span class="label label-inverse" style="font-size: 25px;">Historicos:</span>
         </div>
<!--         <h3>
           <p style="text-height: max-size;" class="text-info">
               Historicos:
           </p> 
         </h3>-->
     <?php break;
 } ?>

<!--    class="display" id="example" cellpadding="0" cellspacing="0" border="0"-->
<table class="table table-bordered table-hover" >
        <thead style="background-color: #F0ECF6;">
            <tr>
                <th>Apellido</th>
                <th>Nombre</th>
                <th>DNI</th>
                <th>Opciones</th>
            </tr>
        </thead>
        <tbody>           
    <?php foreach ($this->clientes as $cliente): ?>
            
            <tr style="background: #A5A8F9">
                <?php //$cliente = new Doctrine_Model_Entities_Cliente();?>
                <td style="font-style: italic;font-size: x-large;"><?php echo $cliente->getApellido();?></td>
                <td style="font-style: italic;font-size: x-large;"><?php echo $cliente->getNombre();?></td>
                <td style="font-style: italic;font-size: x-large;"><?php echo $cliente->getNroDocumento();?></td>
                <?php //$ingresos = $cliente->getIngreso();?>
                <?php
                        switch ($this->activos) {
                            case 0: ?>
                                    <td style="width: 400px;" class="center">          
                                        <a class=""
                                            href="<?php echo $this->baseUrl("clientes/cliente/detallecliente/cliente_id/{$cliente->getId()}") ?>" id="datoCliente" value="datoCliente" >
                                                Ver Datos
                                        </a> &nbsp;&nbsp;|&nbsp;&nbsp;
                                        <a 
                                            href="<?php echo $this->baseUrl("clientes/cliente/veringresoscliente/cliente_id/{$cliente->getId()}") ?>" id="verSesion" value="verSesion">
                                            Ver Sesiones
                                        </a> &nbsp;&nbsp;|    
                                    </td>
                            <?php 
                            break;
                            
                            case 1: ?>
                                    <td style="width: 400px;" class="center">
                                        <a class=""
                                            href="<?php echo $this->baseUrl("clientes/cliente/detallecliente/cliente_id/{$cliente->getId()}") ?>" id="datoCliente" value="datoCliente" >
                                                Ver Datos
                                        </a> &nbsp;&nbsp;|&nbsp;&nbsp;
                                        <a 
                                            href="<?php echo $this->baseUrl("clientes/cliente/veringresoscliente/cliente_id/{$cliente->getId()}") ?>" id="verSesion" value="verSesion">
                                            Ver Sesiones
                                        </a> &nbsp;&nbsp;|   
<!--                                        <a 
                                            href="<?php // echo $this->baseUrl("clientes/cliente/detalleingresohistorico/cliente_id/{$cliente->getId()}") ?>" id="verSesion" value="verSesion">
                                            Ver Sesiones
                                        </a> &nbsp;&nbsp;|-->  
                                    </td>
<!--                                    <td>
                                        <a class="btn btn-success btn-large ingreso_activo" 
                                        href="<?php echo $this->baseUrl("clientes/cliente/detalleingresoactivo/cliente_id/{$cliente->getId()}") ?>" id="tomarsesion" value="tomarSesion" >
                                            Tomar Sesion
                                        </a>
                                    </td>-->

                            <?php 
                            break;
                        
                            case 2: ?>
                                    <td style="width: 400px;" class="center">
                                        <a class=""
                                            href="<?php echo $this->baseUrl("clientes/cliente/detallecliente/cliente_id/{$cliente->getId()}") ?>" id="datoCliente" value="datoCliente" >
                                                Ver Datos
                                        </a> &nbsp;&nbsp;|&nbsp;&nbsp;
                                         <a 
                                            href="<?php echo $this->baseUrl("clientes/cliente/veringresoscliente/cliente_id/{$cliente->getId()}") ?>" id="verSesion" value="verSesion">
                                            Ver Sesiones
                                        </a> &nbsp;&nbsp;|
<!--                                        <a 
                                            href="<?php // echo $this->baseUrl("clientes/cliente/detalleingresohistorico/cliente_id/{$cliente->getId()}") ?>" id="verSesion" value="verSesion">
                                            Ver Sesiones
                                        </a> &nbsp;&nbsp;|-->    
                                    </td>
<!--                                    <td>
                                        <a class="btn btn-warning btn-large ingreso_activo" 
                                        href="<?php echo $this->baseUrl("clientes/cliente/detalleingresohistorico/cliente_id/{$cliente->getId()}") ?>" id="tomarsesion" value="tomarSesion">
                                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Detalle&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                        </a>

                                    </td>-->

                            <?php
                            break;

                        } ?>
            </tr>
            <?php endforeach; ?><!-- fin del foreach cliente -->
        </tbody>
 </table>

<?php endif; ?>

<script type="text/javascript">
    $(document).ready(function(){
        $(".ingreso_activo").colorbox({
            iframe:true, 
            innerWidth: "60%", 
            innerHeight: "60%",
            onClosed:function(){ location.reload(true); } });

    });
</script>
<script>
/* 
 * Example init
 */
$(document).ready(function() {
    oTable = $('#example').dataTable({
        "bJQueryUI": true,
        "sPaginationType": "full_numbers"
    });
} );
</script>

<script type="text/javascript">

    $(document).ready(function(){ 
        if ($("#txt_apellido").val() != "" ||  $("#txt_dni").val() != ""){
            $("#busqueda").validate({
            ignoreTitle: true,
            errorPlacement: false,
            rules: {
                /* personal cliente */
                txt_dni: {required: function (){ return $("#txt_apellido").val() == "" ?  true : false },number: true, minlength: 7, maxlength: 8}, 
                txt_apellido: {required: function (){ return $("#txt_dni").val() == "" ?  true : false }}
            },
            highlight: function(element, errorClass) {
                $(element).attr('style', 'border:1px solid red; background-color:#FF7373; color:black;');
            },
            unhighlight: function(element, errorClass, validClass) {
                $(element).attr("style", "");
            },
            errorPlacement: function(error, element) {
            }
            });
        }
        
    });
    function borrarCliente(elem){
                
                    Sexy.confirm('Se eliminara de forma permanente un cliente.Esta seguro?',
                    {
                        
                        onComplete: function (valor){
                            if (valor) {
                                 $(".ingreso_activo").colorbox.close(); 
                                Sexy.alert('Cliente eliminado con Exito!');
                               
                            } 
                        }
                    });
                return false;
    }
    
</script>